
package com.crm.dao.permission;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.crm.pojo.CrmDept;

public interface CrmDeptDAO extends CrudRepository<CrmDept, Long> {

	@Query("from CrmDept cd where cd.isDel = '是' order by cd.id desc ")
	public List<CrmDept> queryPage(Pageable pageable);
	
	@Query("from CrmDept cd where cd.crmDname like ?1 and cd.isDel = '是' order by cd.id desc")
	public List<CrmDept> queryCrmDept(String crmDname,Pageable pageable);
	
	@Query(value=" select count(*) from CrmDept cd where cd.isDel = '是' ")
	public Long queryShiCount();
	
	@Query(value=" select count(*) from CrmDept cd where cd.isDel = '是' and cd.crmDname like ?1 ")
	public Long queryShiNmeCount(String crmDname);
	
	@Query("from CrmDept cd where cd.isDel = '是' order by cd.id desc ")
	public List<CrmDept> queryAllDept();
	
	@Query("from CrmDept cd where cd.crmDname = ?1 and cd.isDel = '是' order by cd.id desc")
	public CrmDept queryOneCrmDept(String crmDname);
	
	
}

